import request from '@/utils/request'

// 客户查询
export function getPageCustomer(query) {
  return request({
    url: '/customer/getPageCustomer',
    method: 'post',
    params: query
  })
}

// 获取用户积分
export function getPoint(query) {
  return request({
    url: '/customer/getPoint',
    method: 'post',
    params: query
  })
}

export function getPointHistory(customerID) {
  return request({
    url: `/customer/points/${customerID}`,
    method: 'get'
  })
}

// 获取客户权益
export function getEquity(query) {
  return request({
    url: '/customer/getEquity',
    method: 'post',
    params: query
  })
}

// 获取客户保单
export function getPolicyByCustomerID(customerID) {
  return request({
    url: `/customer/getPolicy/${customerID}`,
    method: 'get'
  })
}

// 获取客户信息
export function getCustomer(customerID) {
  return request({
    url: `/customer/full-info/${customerID}`,
    method: 'get'
  })
}

// 获取客户服务
export function getServices(query) {
  return request({
    url: '/customer/getServices',
    method: 'get',
    params: query
  })
}

export function getPolicyServices(policyID) {
  return request({
    url: `/customer/services/policy/${policyID}`,
    method: 'get'
  })
}

export function getCustomerServices(customerID) {
  return request({
    url: `/customer/getServices/${customerID}`,
    method: 'get'
  })
}

// 短信获取业务类型
export function getBusinessType(query) {
  return request({
    url: '/customer/getBusinessType',
    method: 'post',
    params: query
  })
}

// 短信列表
export function getMessage(query) {
  return request({
    url: '/message/getMessage',
    method: 'post',
    params: query
  })
}

// 导出
export function downloadCustomer(data) {
  return request({
    url: '/excel/downloadCustomer',
    method: 'post',
    headers: {
      "Content-Type": "multipart/form-data"
    },
    data
  })
}

export function downloadBlob(params) {
  return request({
    url: '/excel/downloadCustomer',
    method: 'get',
    params,
    responseType: 'blob'
  })
}
